package org.lansir.af.dataview;

import java.util.Comparator;

/**
 * 
 * @author 蓝智宏
 *
 */
public class DataViewItemActivityComparator implements Comparator<DataViewItem> {

	
	@Override
	public int compare(DataViewItem item1, DataViewItem item2) {
		DataViewItemActivity itemActivity1 = (DataViewItemActivity) item1;
		DataViewItemActivity itemActivity2 = (DataViewItemActivity) item2;
		int iDate1Cmp = itemActivity1.getTimeAsSeconds();
		int iDate2Cmp = itemActivity2.getTimeAsSeconds();
		int iFlag = iDate1Cmp - iDate2Cmp;
		if (iFlag > 0) {
			return 1;
		} else if (iFlag < 0) {
			return -1;
		} else {
			String s1 = itemActivity1.getSubject();
			String s2 = itemActivity2.getSubject();
			return s1.compareTo(s2);
		}
	}

}
